package JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo4 {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/birdbootdb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true","root","root");
        Statement state = conn.createStatement();
        String sql = "DELETE FROM userinfo " +
                      "WHERE username='张三';";
        int num = state.executeUpdate(sql);
        if (num>0){
            System.out.println("成功修改了"+num+"条记录");
        }else {
            System.out.println("修改失败");
        }
        conn.close();
    }
}
